<template>
	<view class="">
		<!--  -->
		<ben></ben>
		<!--  -->
		<view class="cartShop column pad20 min30 rad1">
			<!-- 商家列表 -->
			<view class="cartName-box minbottom20">
				<image :src="list[0].shop_logo" class="cartName-img rad1 minright10"></image>
				<view class="omit1 size26 col3 font600" style="max-width:400rpx;">
					{{ list[0].shop_name }}
				</view>
				<!-- <view class="minau minright0 size24 font600" style="color: #FE3C3C;">
					待核销
				</view> -->
			</view>
			<!-- 商品列表 -->
			<view class="row" style="margin-bottom: 20rpx;" v-for="(info, k) in list" :key="k">
				<view class="rad1">
					<image :src="info.goods_cover" class="cartDetail-imgs rad1"></image>
				</view>
				<view class="column minleft10 flex1">
					<view class="size28 col3 font600 omit1">{{ info.goods_name }}</view>
					<view class="cartNum minto minbottom10">
						<view class="size24 col9 font500 mintop10">
							规格：{{ info.specs_name }}
						</view>
						<view class="size26 col6 font500">
							数量：{{ info.specs_num }}
						</view>
					</view>
				</view>
			</view>
			<view class="column padtop20" style="border-top: 2rpx solid #f6f6f6;">
				<view class="col3 size26 font500">
					订单编号：{{ order_no }}
				</view>
				<view class="col3 size26 font500 mintop10">
					下单时间：{{ create_time }}
				</view>
				<view class="col3 size26 font500 mintop10">
					实付:￥{{ total_price }}
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				order_no: '',
				total_price: '',
				create_time: '',
				list: []
			}
		},

		onLoad(op) {
			this.id = op.id
			this.order_no = op.order_no
			this.create_time = op.create_time
			this.total_price = op.total_price
		},
		onShow() {
			//当前页面展示的时候他就执行该生命周期
			const token = uni.getStorageSync('token');
			// this.user_id = uni.getStorageSync('user_id');
			if (token) {
				//如果存在token
				this.getOrderinfo()
				//按正常逻辑来讲 登录成功 我们是不是需要向服务器获取用户的信息？
				//那么我们一起来获取用户信息
			} else {

				uni.showToast({
					title: '您还未登录，正在前往登录',
					icon: 'none'
				})
				setTimeout(function() {
					uni.navigateTo({
						url: "/mypackage/user/login"
					})
				}, 1000)
			}
		},
		methods: {
			async getOrderinfo() {
				let {
					code,
					message,
					data
				} = await this.$com.fetchGet("member/order_info/" + this.id)
				if (code == 200) {
					this.list = data
				} else {
					console.log(message);
				}
			},
			checkboxChange(e) {
				console.log(e);
			},


		}
	}
</script>

<style scoped lang="less">
	.cartShop {
		box-shadow: 0 0 9rpx 3rpx #ccc;
		background-color: white;
	}

	.cartName {
		font-size: 29rpx;
		color: #333333;
		display: flex;
		align-items: center;
	}

	.cartName-box {
		height: 30rpx;
		display: flex;
		align-items: center;
	}

	.cartName-img {
		width: 50rpx;
		height: 50rpx;
	}

	.cartDetail-imgs {
		width: 200rpx;
		height: 160rpx;
	}

	.cartNum {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
</style>